Skip to content

make an "add as friend" web component#826

Open
SharonStrats wants to merge 5 commits into
stagingfrom
feat/add-friends-component
Open

make an "add as friend" web component#826
SharonStrats wants to merge 5 commits into
stagingfrom
feat/add-friends-component

Conversation

@SharonStrats

Copy link
Copy Markdown
Contributor

This moves over the code from profile-pane for adding as a friend and creates a Web Component from the code.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new solid-ui-button-add-friend web component by extracting the “add as friend” behavior into a reusable component, along with supporting helpers, styling, and a Storybook story.

Changes:

  • Added ButtonAddFriend web component that checks login state, detects existing friendships, and performs the FOAF knows mutation.
  • Added helper to ensure standard RDF prefixes are registered for rdflib mutations.
  • Added component styling and a Storybook story for basic states.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/components/button-add-friend/index.ts Barrel export for the new add-friend component.
src/components/button-add-friend/helpers.ts Adds prefix-registration helper used before rdflib updates.
src/components/button-add-friend/ButtonAddFriend.ts Implements the add-friend web component and mutation logic.
src/components/button-add-friend/ButtonAddFriend.styles.css Styles the inline status banner shown on error.
src/components/button-add-friend/ButtonAddFriend.stories.ts Storybook coverage for guest/logged-in/friend-exists states.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/button-add-friend/ButtonAddFriend.ts Outdated
Comment thread src/components/button-add-friend/ButtonAddFriend.ts
Comment thread src/components/button-add-friend/ButtonAddFriend.ts
Comment thread src/components/button-add-friend/ButtonAddFriend.ts
Comment thread src/components/button-add-friend/ButtonAddFriend.stories.ts Outdated
Comment thread src/components/button-add-friend/ButtonAddFriend.stories.ts Outdated
Comment thread src/components/button-add-friend/ButtonAddFriend.styles.css
@SharonStrats SharonStrats force-pushed the feat/add-friends-component branch 2 times, most recently from 2253b1e to 69ec36f Compare July 3, 2026 02:30
@SharonStrats SharonStrats force-pushed the feat/add-friends-component branch from 69ec36f to ab67365 Compare July 3, 2026 02:36
Prompt: Create stories for ButtonAddFriend for guest, loggedin and FriendExists follow
the stories in the Component directory

Co-authored-by: GPT-5.4 Mini <gpt-5.4-mini@openai.com>
@timea-solid

Copy link
Copy Markdown
Member

Looks ok to me, but I would appreciate Noels review.

@NoelDeMartin NoelDeMartin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the general direction is ok, but there are a couple of things that should be improved to make this more "idiomatic".

Also, regarding the name, maybe it should be called "add-friend-button" instead? I worry this is too specific to be in the generic solid-ui package, but I understand we're doing this to use it in two different panes so I guess it's ok. Whenever we prepare developer documentation, we should probably make sure that this type of component is in a different section or something (also using storybook groups, etc.).

Comment on lines +35 to +36
@property({ attribute: false })
accessor context: DataBrowserContext | undefined = undefined

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be passing the context as an attribute, it should be a context provided by a parent component. We already do this with the auth context, so we could reuse that one or create a dedicated one for the store.

Timea has been working on this, and she's leaning more towards having a separate "StoreContext". Check it out in her PR, as they should both follow the same approach: #798

@SharonStrats SharonStrats Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably wait until Timea merges that PR then so i can use the store she added.

Comment thread src/components/button-add-friend/ButtonAddFriend.styles.css
Comment thread src/components/button-add-friend/ButtonAddFriend.stories.ts
Comment on lines +38 to +39
@property({ attribute: false })
accessor buttonLabel = addMeToYourFriendsButtonText

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be state rather than a property... Or seeing that this is derived from other state, maybe it could just be a getter that we call in the render.

@SharonStrats SharonStrats Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it depends on async work for refresh so i'm going to change it to state instead of a getter.

Comment thread src/components/button-add-friend/ButtonAddFriend.ts Outdated
accessor buttonLabel = addMeToYourFriendsButtonText

@property({ attribute: false })
accessor statusMessage = ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this should probably be state, not a property.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry yes i understand now.

@SharonStrats SharonStrats moved this from In review to In progress in SolidOS NLNet UI Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

createAddMeToYourFriendsButton should become a web component in solid-ui

4 participants